<?php $this->load->view('admin/admin_header');?>
		<!-- BEGIN CONTENT -->
		<div class="page-content-wrapper">
			<div class="page-content">
				<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
				<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
								<h4 class="modal-title">Modal title</h4>
							</div>
							<div class="modal-body">
								 Widget settings form goes here
							</div>
							<div class="modal-footer">
								<button type="button" class="btn blue">Save changes</button>
								<button type="button" class="btn default" data-dismiss="modal">Close</button>
							</div>
						</div>
						<!-- /.modal-content -->
					</div>
					<!-- /.modal-dialog -->
				</div>
				<!-- /.modal -->
				<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
				<!-- BEGIN STYLE CUSTOMIZER -->
				<div class="theme-panel">
					<div class="theme-options">
						<div class="theme-option theme-colors clearfix">
							<span>
							THEME COLOR </span>
							<ul>
								<li class="color-default current tooltips" data-style="default" data-container="body" data-original-title="Default">
								</li>
								<li class="color-grey tooltips" data-style="grey" data-container="body" data-original-title="Grey">
								</li>
								<li class="color-blue tooltips" data-style="blue" data-container="body" data-original-title="Blue">
								</li>
								<li class="color-dark tooltips" data-style="dark" data-container="body" data-original-title="Dark">
								</li>
								<li class="color-light tooltips" data-style="light" data-container="body" data-original-title="Light">
								</li>
							</ul>
						</div>
						<div class="theme-option">
							<span>
							Theme Style </span>
							<select class="layout-style-option form-control input-small">
								<option value="square" selected="selected">Square corners</option>
								<option value="rounded">Rounded corners</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Layout </span>
							<select class="layout-option form-control input-small">
								<option value="fluid" selected="selected">Fluid</option>
								<option value="boxed">Boxed</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Header </span>
							<select class="page-header-option form-control input-small">
								<option value="fixed" selected="selected">Fixed</option>
								<option value="default">Default</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Top Dropdown</span>
							<select class="page-header-top-dropdown-style-option form-control input-small">
								<option value="light" selected="selected">Light</option>
								<option value="dark">Dark</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Sidebar Mode</span>
							<select class="sidebar-option form-control input-small">
								<option value="fixed">Fixed</option>
								<option value="default" selected="selected">Default</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Sidebar Style</span>
							<select class="sidebar-style-option form-control input-small">
								<option value="default" selected="selected">Default</option>
								<option value="compact">Compact</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Sidebar Menu </span>
							<select class="sidebar-menu-option form-control input-small">
								<option value="accordion" selected="selected">Accordion</option>
								<option value="hover">Hover</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Sidebar Position </span>
							<select class="sidebar-pos-option form-control input-small">
								<option value="left" selected="selected">Left</option>
								<option value="right">Right</option>
							</select>
						</div>
						<div class="theme-option">
							<span>
							Footer </span>
							<select class="page-footer-option form-control input-small">
								<option value="fixed">Fixed</option>
								<option value="default" selected="selected">Default</option>
							</select>
						</div>
					</div>
				</div>
				<!-- END STYLE CUSTOMIZER -->
				<!-- BEGIN PAGE HEADER-->
				
				<!-- END PAGE HEADER-->
						<div class="row">
					<div class="col-md-12">
						<!-- BEGIN VALIDATION STATES-->
						<div class="portlet box blue">
										<div class="portlet-title">
											<div class="caption">
												<i class="fa fa-gift"></i>Create Classified
											</div>
											<div class="tools">
												<a href="javascript:;" class="collapse">
												</a>
												<a href="#portlet-config" data-toggle="modal" class="config">
												</a>
												<a href="javascript:;" class="reload">
												</a>
												<a href="javascript:;" class="remove">
												</a>
											</div>
										</div>
										<div class="portlet-body form">
												<div class="form-actions right">
													<button type="submit" name="upload" class="btn blue"><i class="fa fa-check"></i>Upload</button>
												</div>
												
													<?php echo form_open_multipart('admin/events/edit_events/', array('class'=>'horizontal-form'));?>
													<div class="form-body">
													<div class="row">
														<div class="col-md-6">
															<div class="form-group">
																<label class="control-label">Title</label>
																<input name="title" value="<?php echo $events_get_event->event[0]->event_title;?>" type="text" id="firstName" class="form-control"><?php echo form_error('title');?>
															</div>
														</div>
														<div class="col-md-6">
															<div class="form-group">
															<label class="control-label">Event Type</label>
															<select name="event_type" id="event_type" onchange="addmovies()" class="select2_category form-control" data-placeholder="Choose a Category" tabindex="1">
																<option value="">Select</option>
																<?php foreach($event_type_list->result as $event_type):?>
																<?php if($event_type->event_type_id == $events_get_event->event[0]->event_type_id):?>
																<option selected="selected" value="<?php echo $event_type->event_type_id.'-'.$event_type->category_name;?>"><?php echo $event_type->event_type_name;?></option>
																<?php else:?>
																<option value="<?php echo $event_type->event_type_id.'-'.$event_type->category_name;?>"><?php echo $event_type->event_type_name;?></option>
																<?php endif; endforeach;?>
															</select><?php echo form_error('event_type');?>
															</div>
														</div>
														<div class="col-md-6">
															<div class="form-group">
															<?php if($events_get_event->event[0]->is_upcomming_event == 1):?>
																<input checked="checked" name="upcoming" type="checkbox" id="firstName" class="form-control">Is this upcoming event
															<?php else:?>
																<input name="upcoming" type="checkbox" id="firstName" class="form-control">Is this upcoming event
															<?php endif; echo form_error('upcoming');?>
															</div>
														</div>
													</div>													
													<div class="row">
														<div class="col-md-6">
															<div class="form-group">
															<label class="control-label">Association</label>
															<select name="assc" class="select2_category form-control" data-placeholder="Choose a Category" tabindex="1">
																<option value="">Select</option>
																<?php foreach($get_association_list->result as $association):?>
																<?php if($events_get_event->event[0]->association_id == $association->association_id):?>
																<option selected="selected" value="<?php echo $association->association_id;?>"><?php echo $association->association_name;?></option>
																<?php else:?>
																<option value="<?php echo $association->association_id;?>"><?php echo $association->association_name;?></option>
																<?php endif; endforeach;?>
															</select><?php echo form_error('assc');?>
															</div>
														</div>
														<div class="col-md-6">
															<div class="form-group">
																<label class="control-label">Credit Cards Charges</label>
																<input name="credit" value="<?php echo $events_get_event->event[0]->credit_card_charges;?>" type="text" id="firstName" class="form-control"><?php echo form_error('credit');?>
															</div>
														</div>
														<div class="col-md-6">
															<div class="form-group">
																<label class="control-label">Event Image</label>
																<input name="event_image" type="file" id="firstName"><?php echo $events_get_event->event[0]->event_image_title;?>
															</div>
														</div>
													</div>
													
													<?php //echo '<pre>';print_r($events_get_event->moviedetail);?>
													<?php if(count($events_get_event->moviedetail) > 0):?>
														<div id="movies">
															<div id='movie_sub_div'>
																<hr style='border: 1px solid #000';>
																	<div class='row'>
																		<div class='col-md-6'>
																			<div class='form-group'>
																				<label class='control-label'>Director</label>
																				<input type="hidden" value="<?php echo $events_get_event->moviedetail[0][0]->movie_detail_id;?>" name="movie_detail_id"/>
																				<input type='text' value="<?php echo $events_get_event->moviedetail[0][0]->director;?>" class='form-control' name='director' />
																			</div>
																		</div>
																		<div class='col-md-6'>
																			<div class='form-group'>
																				<label class='control-label'>Producer</label>
																				<input type='text' value="<?php echo $events_get_event->moviedetail[0][0]->producer;?>"  name='producer' class='form-control'/>
																			</div>
																		</div>
																	</div>
																	<div class='row'>
																		<div class='col-md-6'>
																			<div class='form-group'>
																				<label class='control-label'>Music Director</label>
																				<input value="<?php echo $events_get_event->moviedetail[0][0]->music_director;?>" name='music_director' type='text'  class='form-control'/>
																			</div>
																		</div>
																		<div class='col-md-6'>
																			<div class='form-group'>
																				<label class='control-label'>Release Date</label>
																				<input value="<?php echo $events_get_event->moviedetail[0][0]->release_date;?>"  name='release_date' type='date' class='form-control'/>
																			</div>
																		</div>
																	</div>
																	<div class='row'>
																		<div class='col-md-6'>
																			<div class='form-group'>
																				<label class='control-label'>Star Cast</label>
																				<input type='text' value="<?php echo $events_get_event->moviedetail[0][0]->star_cast;?>" name='starcast' class='form-control'/>
																			</div>
																		</div>
																	</div>
																<hr>
																<label class='control-label'>Movie Images</label>
																<div id='movie_image'>
																<?php if(count($events_get_event->moviedetail[1]) > 0):?>
																<?php foreach($events_get_event->moviedetail[1] as $movie):?>
																	<div class='row movie_length' id='rem_mov_img<?php echo $movie->movie_image_id; ?>'>
																		<div class='col-md-6'>Movie Image (min 550 x 350)</div>
																		<div class='col-md-6'>
																			<input type="hidden" value="<?php echo $movie->movie_image_id; ?>" name="hide_movie[]"/>
																			<input type='file' name='movie_image[]' value='' id='movie_value<?php echo $movie->movie_image_id; ?>' class='movie_value'/><?php echo $movie->movie_image_title; ?>
																			<button type='button' onclick='remove_movie_image("<?php echo $movie->movie_image_id;?>","<?php echo $movie->movie_image_id;?>");'>Remove</button>
																		</div>
																	</div>
																<?php endforeach; endif; ?>
																</div>
																<div class='row'>
																	<div class='col-md-6'>
																		<br>
																		<button type='button' id='movie_count' onclick='add_movie_image(0)' class='btn blue'>Add Movie Image</button>
																	</div>
																</div>
															<hr><hr>
															<label class='control-label'>Star Cast</label>			
																<?php //echo '<pre>';print_r($events_get_event->moviedetail[2]);?>
															<div id='star_cast'>
															<?php if(count($events_get_event->moviedetail[2]) > 0):?>
															<?php foreach($events_get_event->moviedetail[2] as $star_cast):?>
																<div class='row' id='rem_star_cast<?php echo $star_cast->movie_starcast_image_id;?>'>
																	<div class='col-md-6'>
																		<label class='control-label'>Star Name</label>
																		<input type="hidden" name="hide_star_cast[]" value="<?php echo $star_cast->movie_starcast_image_id;?>"/>
																		<input type='text' value="<?php echo $star_cast->starcast_image_title;?>" name='star_cast[]' class='form-control'/>
																	</div>
																	<div class='col-md-6'>
																		<label class='control-label'>Star Image</label>
																		<input type='file' name='star_image[]' />
																		<?php echo $star_cast->starcast_name;?>
																		<button type='button' onclick='remove_star_cast("<?php echo $star_cast->movie_starcast_image_id;?>","<?php echo $star_cast->movie_starcast_image_id;?>");'>Remove</button>
																	</div>
																</div>
															<?php endforeach; endif; ?>
															</div>
															<div class='row'>
																<div class='col-md-6'>
																	<br>
																	<button type='button' onclick='add_star_cast()' class='btn blue'>Add Star</button>
																</div>
															</div>
															<hr><hr>
															<label class='control-label'>YouTube Videos</label>
															<div id='youtube_vid'>
																<?php if($events_get_event->moviedetail[3] > 0):?>
																<?php foreach($events_get_event->moviedetail[3] as $video):?>
																<div id='rem_vid<?php echo $video->movie_youtube_video_id; ?>'>
																	<div class='row'>
																		<div class='col-md-6'>
																			<input type="hidden" value="<?php echo $video->movie_youtube_video_id; ?>" name="hide_video[]"/>
																			<input name='video_name[]' value="<?php echo $video->video_name; ?>" type='text' placeholder='Video Name' class='form-control'/>
																		</div>
																		<div class='col-md-6'>
																			<input name='video_url[]' value="<?php echo $video->video_url; ?>" type='text' placeholder='Video URL' class='form-control'/>
																		</div>
																	</div>
																	<div class='row'>
																		<div class='col-md-6'>
																			<input type='text' value="<?php echo $video->video_image_url; ?>" name='video_image[]' placeholder='Video Image URL' class='form-control'/>
																		</div>
																		<div class='col-md-6'>
																			<button type='button' onclick='remove_videos("<?php echo $video->movie_youtube_video_id; ?>","<?php echo $video->movie_youtube_video_id; ?>");'>Remove</button>
																		</div>
																	</div>
																</div>
																<?php endforeach; endif;?>
															</div>
															<div class='row'>
																<div class='col-md-6'>
																	<br>
																	<button type='button' onclick='add_videos()' class='btn blue'>Add video</button>
																</div>
															</div>
															<hr><hr style='border: 1px solid #000';>
														</div>
													</div>
												<hr>
												<?php endif; ?>
												<?php //echo '<pre>';print_r((array) $get_event_location_list);exit;?>
												<label class="control-label">Event Location_Timings</label><br>
												<div id="location_add">
													<?php //echo '<pre>';print_r($events_get_event->locations[0]);?>
													<?php if(count($events_get_event->locations[0]) > 0) :?>
													<?php foreach($events_get_event->locations[0] as $id=>$location):?>
														<div id='rem_loc<?php echo $location->event_location_time_id;?>'>
															`<div class='row'>
																<div class='col-md-6'>
																<input type="hidden" value="<?php echo $location->event_location_time_id;?>" name="hide_time_id[]"/>
																	<label class='control-label'>Location</label>
																	<select name='location[]' class="select2_category form-control" data-placeholder="Choose a Category" tabindex="1">
																		<option value="">Select</option>
																	<?php foreach($get_event_location_list->result as $loc_list):?>
																	<?php if($loc_list->location_id == $location->location_id):?>
																		<option selected="selected" value="<?php echo $loc_list->location_id;?>"><?php echo $loc_list->location_name;?></option>
																	<?php else:?>
																		<option value="<?php echo $loc_list->location_id;?>"><?php echo $loc_list->location_name;?></option>
																	<?php endif; endforeach;?>
																	</select><?php echo form_error('location');?>
																	</div>
																	<div class='col-md-6'>
																		<label class='control-label'>Date</label>
																		<input type='date' value="<?php echo $location->event_date;?>" name='date[]' class='form-control'/>
																	</div>
																</div>
																<div class='row'>
																	<div class='col-md-6'>
																		<label class='control-label'>Time</label>
																		<input type='time' value="<?php echo $location->event_time;?>" name='time[]' class='form-control'/>
																	</div>
																<div class='col-md-6'>
																	<input type='text' value="<?php echo $location->number_of_tickets;?>" name='ticket[]' value='0' class='form-control'/>
																</div>
															</div>
															<div class='row'>
																<div class='col-md-6'>
																<?php if($location->stop_ticket == 1):?>
																	<input value='0' name='stop_ticket[<?php echo $location->event_location_time_id; ?>]' type='hidden'/>
																	<input checked="checked" name='stop_ticket[<?php echo $location->event_location_time_id; ?>]' type='checkbox'/> Stop Ticket Sale
																<?php else:?>
																	<input value='0' name='stop_ticket[<?php echo $location->event_location_time_id; ?>]' type='hidden'/>
																	<input name='stop_ticket[<?php echo $location->event_location_time_id; ?>]' type='checkbox'/> Stop Ticket Sale
																<?php endif; ?>
																</div>
															</div>
															<div class='row'>
																<div class='col-md-6'>
																	<label class='control-label'>Price</label>
																	<?php //echo '<pre>';print_r($events_get_event->locations);?>
																	<select name='price[]' class="select2_category form-control" data-placeholder="Choose a Category" tabindex="1">
																		<option value="">Select</option>
																	<?php foreach($get_event_price_list->result as $price_list):?>
																	<?php if($price_list->event_pricing_id == $location->event_pricing_id):?>
																		<option selected="selected" value="<?php echo $price_list->event_pricing_id;?>"><?php echo $price_list->pricing_name;?></option>
																	<?php else:?>
																		<option value="<?php echo $price_list->event_pricing_id;?>"><?php echo $price_list->pricing_name;?></option>
																	<?php endif; endforeach;?>
																	</select><?php echo form_error('price');?>
																</div>
																<div class='row' id='event_price<?php echo $location->event_location_time_id;?>'>
																</div>
															</div>
															<div class='row'>
																<div class='col-md-6'>
																	<button type='button' onclick='remove_add_location("<?php echo $location->event_location_time_id;?>","<?php echo $location->event_location_time_id;;?>");'>Remove</button>
																</div>
															</div>
														</div>
														<hr>
													<?php endforeach; endif; ?>
												</div>
												<div class="row">
													<div class="col-md-6">
														<button type="button" onclick="add_location()" class="btn blue">Add Location</button>
													</div>
												</div>
												<hr>
												<div class="row">
														<div class="col-md-6">
													     <div class="form-group">
													    <label class="control-label">Description</label>
													     <textarea name="description" class="form-control" rows="6" cols="50" ><?php echo $events_get_event->event[0]->event_description;?></textarea><?php echo form_error('description');?>
													    </div>
													  </div>
													</div>
												<div class="row">
														<div class="col-md-6">
															<div class="form-group">
																<label class="control-label">Sponsor Logo</label>
																<input name="sponsor" type="file" id="firstName"><?php echo $events_get_event->event[0]->sponsor_title;?>
															</div>
															</div>
														<div class="col-md-6">
															<div class="form-group">
																<label class="control-label">Sponsor Email Logo</label>
																<input name="sponsor_email" type="file" id="firstName"><?php echo $events_get_event->event[0]->sponsor_email_title;?>
															</div>
															</div>
														<div class="col-md-6">
															<div class="form-group">
																<label class="control-label">Flyer</label>
																<input name="flyer" type="file" id="firstName"><?php echo $events_get_event->event[0]->flyer_title;?>
															</div>
													</div>
													</div>
													<div class="row">
														<div class="col-md-6">
															<div class="form-group">
																<label class="control-label">Sponsor URL (should have http:// or https:// )</label>
																<input name="url" value="<?php echo $events_get_event->event[0]->sponsor_url;?>" type="text" id="firstName" class="form-control"><?php echo form_error('url');?>
															</div>
														</div>
														<div class="col-md-6">
															<div class="form-group">
															<?php if($events_get_event->event[0]->donate == 1):?>
																<input checked="checked" name="donate" type="checkbox" id="firstName" class="form-control">Donate
															<?php else:?>
																<input name="donate" type="checkbox" id="firstName" class="form-control">Donate
															<?php endif; echo form_error('mobile');?>
															</div>
														</div>
													</div>
															<div id='remove_id'>
															<div>
													<div class="form-actions right">
													<button type="button" class="btn default">Cancel</button>
													<button type="submit" name="save" class="btn blue"><i class="fa fa-check"></i> Save</button>
												</div>
											<?php echo form_close(); ?>
											<!-- END FORM-->
										</div>
									</div>
														</div>
													</div>
													
													
	<!-- END CONTAINER -->
<?php echo $this->load->view('admin/admin_footer');?>

<script type="text/javascript">
var rowCount = 0;
function addmovies() {
	var value = jQuery('#event_type').val();
	var split_val = value.split('-');
	var id = split_val[0];
	var type = split_val[1];
	
	if(type == 'movies'){
		var add_movies = "<div id='movie_sub_div'><hr style='border: 1px solid #000';><div class='row'><div class='col-md-6'><div class='form-group'><label class='control-label'>Director</label><input type='text'  class='form-control' name='director' /></div></div><div class='col-md-6'><div class='form-group'><label class='control-label'>Producer</label><input type='text' name='producer' class='form-control'/></div></div></div><div class='row'><div class='col-md-6'><div class='form-group'><label class='control-label'>Music Director</label><input name='music_director' type='text'  class='form-control'/></div></div><div class='col-md-6'><div class='form-group'><label class='control-label'>Release Date</label><input name='release_date' type='date' class='form-control'/></div></div></div><div class='row'><div class='col-md-6'><div class='form-group'><label class='control-label'>Star Cast</label><input type='text' name='starcast' class='form-control'/></div></div></div><hr><label class='control-label'>Movie Images</label><div id='movie_image'></div><div class='row'><div class='col-md-6'><br><button type='button' id='movie_count' onclick='add_movie_image(0)' class='btn blue'>Add Movie Image</button></div></div><hr><hr><label class='control-label'>Star Cast</label><div id='star_cast'></div><div class='row'><div class='col-md-6'><br><button type='button' onclick='add_star_cast()' class='btn blue'>Add Star</button></div></div><hr><hr><label class='control-label'>YouTube Videos</label><div id='youtube_vid'></div><div class='row'><div class='col-md-6'><br><button type='button' onclick='add_videos()' class='btn blue'>Add video</button></div></div><hr><hr style='border: 1px solid #000';></div>";
		jQuery('#movie_sub_div').remove();
		jQuery('#movies').append(add_movies);
	}else{
		jQuery('#movie_sub_div').remove();
	}

}

function add_movie_image(max){
		max++;
		
	if(max <= 5){
		max--;
		if(jQuery('.movie_value').length !== 0 && jQuery('#movie_value'+max).val() == ''){
			alert('please choose file');
		}else{
			max++;
			var movie_id = '';
		var add_movie_image = "<div class='row movie_length' id='rem_mov_img"+max+"'><div class='col-md-6'>Movie Image (min 550 x 350)</div><div class='col-md-6'><input type='file' name='movie_image[]' value='' id='movie_value"+max+"' class='movie_value'/><button type='button' onclick='remove_movie_image("+max+","+movie_id+");'>Remove</button></div></div>";
		jQuery('#movie_image').removeAttr("onclick");
		jQuery('#movie_count').attr("onclick","add_movie_image("+max+")");
		jQuery('#movie_image').append(add_movie_image);
		}
	}else if(jQuery('#movie_value5').val() == ''){
		alert('please choose file');
	}else{
		alert('Maximum Five images can add');
	}
}

function remove_movie_image(remNum,id) {
	if(id !== ''){
		jQuery('#remove_id').append("<input type='hidden' name='remove_movie_id[]' value='"+id+"'>");
	}
var len = jQuery('.movie_length').length;
		len--;
		jQuery('#movie_image').removeAttr("onclick");
		jQuery('#movie_count').attr("onclick","add_movie_image("+len+")");
jQuery('#rem_mov_img'+remNum).remove();
}

function add_star_cast(){
	rowCount++;
	var star_cast='';
	var add_star_cast = "<div class='row' id='rem_star_cast"+rowCount+"'><div class='col-md-6'><label class='control-label'>Star Name</label><input type='text' name='star_cast[]' class='form-control'/></div><div class='col-md-6'><label class='control-label'>Star Image</label><input type='file' name='star_image[]' /><button type='button' onclick='remove_star_cast("+rowCount+","+star_cast+");'>Remove</button></div></div>";
	jQuery('#star_cast').append(add_star_cast);
}

function remove_star_cast(remNum,id) {
	if(id !== ''){
		jQuery('#remove_id').append("<input type='hidden' name='remove_star_id[]' value='"+id+"'>");
	}
jQuery('#rem_star_cast'+remNum).remove();
}

function add_videos(){
	rowCount++;
	var videos='';
	var add_videos = "<div id='rem_vid"+rowCount+"'><div class='row'><div class='col-md-6'><input name='video_name[]' type='text' placeholder='Video Name' class='form-control'/></div><div class='col-md-6'><input name='video_url[]' type='text' placeholder='Video URL' class='form-control'/></div></div><div class='row'><div class='col-md-6'><input type='text' name='video_image[]' placeholder='Video Image URL' class='form-control'/></div><div class='col-md-6'><button type='button' onclick='remove_videos("+rowCount+","+videos+");'>Remove</button></div></div></div>";
	jQuery('#youtube_vid').append(add_videos);
}

function remove_videos(remNum,id) {
	if(id !== ''){
		jQuery('#remove_id').append("<input type='hidden' name='remove_video_id[]' value='"+id+"'>");
	}
jQuery('#rem_vid'+remNum).remove();
}

function add_location(){
	if(jQuery('#event_type').val() !== ''){
	rowCount++;
	var check = rowCount-1;
	 $.ajax({
           'url' :"<?php echo site_url('admin/events/add_location/'); ?>",
		   type: 'get',
		  // dataType: 'json',
           'success' : function(data){
			  var data = data.split('split');
			  var obj = jQuery.parseJSON(data[0]);
			  var location = "<select name='location[]' class='select2_category form-control'><option value=''>Select</option>";
              $.each(obj.result, function(key,item) {
				location = location+"<option value='"+item.location_id+"'>"+item.location_name+"</option>";
			  });
			location = location+"</select>";
			var obj = jQuery.parseJSON(data[1]);
			  var price = "<select name='price[]' onchange='event_pricing(this.value,"+rowCount+");' class='select2_category form-control'><option value=''>Select</option>";
               $.each(obj.result, function(key,item) {
				price = price+"<option value='"+item.event_pricing_id+"'>"+item.pricing_name+"</option>";
			});
			price = price+"</select>";
			var loc_id = '';
			var add_location = "<div id='rem_loc"+rowCount+"'><div class='row'><div class='col-md-6'><label class='control-label'>Location</label>"+location+"</div><div class='col-md-6'><label class='control-label'>Date</label><input type='date' name='date[]' class='form-control'/></div></div><div class='row'><div class='col-md-6'><label class='control-label'>Time</label><input type='time'  name='time[]' class='form-control'/></div><div class='col-md-6'><input type='text' name='ticket[]' value='0' class='form-control'/></div></div><div class='row'><div class='col-md-6'><input value='0' name='stop_ticket["+check+"]' type='hidden'/><input name='stop_ticket["+check+"]' type='checkbox'/> Stop Ticket Sale</div></div><div class='row'><div class='col-md-6'><label class='control-label'>Price</label>"+price+"</div><div class='row' id='event_price"+rowCount+"'></div></div><div class='row'><div class='col-md-6'><button type='button' onclick='remove_add_location("+rowCount+","+loc_id+");'>Remove</button></div></div></div><hr>";
			jQuery('#location_add').append(add_location);
			}
              });
	}else{
		alert('please select event type');
	}
}

function remove_add_location(remNum,id) {
	if(id !== ''){
	jQuery('#remove_id').append("<input type='hidden' name='remove_loc_id[]' value='"+id+"'>");
}
jQuery('#rem_loc'+remNum).remove();
}

function event_pricing(id,rowNum){
	if(id !== ''){
	 $.ajax({
           'url' : "<?php echo site_url('admin/events/event_pricing/'); ?>"+"/"+id,
		   type: 'get',
		  // dataType: 'json',
           'success' : function(data){
			  var obj = jQuery.parseJSON(data);
			  var price_rate = "<p id='price_rate"+rowNum+"'>";
			  $.each(obj.result, function(key,item) {
				price_rate = price_rate+item.pricing_for+":"+item.rate+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			  });
				price_rate = price_rate+"</p>";
			  jQuery('#price_rate'+rowNum).remove();
			  jQuery('#event_price'+rowNum).append(price_rate);
			}
              });
	}else{
		 jQuery('#price_rate'+rowNum).remove();
	}
}
</script>